﻿using UnityEngine;
using System.Collections;

public class BackgroundController : MonoBehaviour
{

    public GameObject chuCai;
    public Vector3[] arrayVector;
    public string[] ArrStrings;
    public Vector3 vectorA = new Vector3(5.6f,3.0f,0);
    public GameObject tay;
	// Use this for initialization
	void Start ()
	{
	    int count = 0;
        ArrStrings = new string[4] { "a", "b", "c", "d" };
        arrayVector = new Vector3[4] { new Vector3(3.8f, 0.6f, 0), new Vector3(7.8f, 0.6f, 0), new Vector3(5.8f, 0.6f, 0), new Vector3(-7.1f, 2.1f, 0) };
	    foreach (Vector3 vector in arrayVector)
	    {
            //GameObject a = (GameObject) Instantiate(chuCai, vector, Quaternion.identity);
            //a.GetComponent<ChuCaiController>().Chu = ArrStrings[count];
            //Debug.Log(arrayVector.Length);
            //count++;
	    }
	    tay = GameObject.Find("tay");
	}
	
	// Update is called once per frame
	void Update ()
	{
	    tay.transform.position = Vector3.MoveTowards(tay.transform.position, vectorA, Time.deltaTime * 2);
	}
    void OnCollisionEnter2D(Collision2D coll)
    {

    }
}
